package com.doyens.gmall.mq.controller;

import com.doyens.gmall.common.config.RabbitService;
import com.doyens.gmall.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
@RequestMapping("/mq")
public class MqController {


    @Autowired
    private RabbitService rabbitService;

    @RequestMapping("sendConfirm")
    public Result sendConfirm(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String now = sdf.format(new Date());
        rabbitService.sendMessage("exchange.confirm","routing.confirm","第一条message:"+now);
        return Result.ok();
    }
}
